package cn.com.hbhgkj.dao.hibernate;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import cn.com.hbhgkj.dao.CopyrightAlterationDao;
import cn.com.hbhgkj.model.CopyrightAlteration;
import cn.com.hbhgkj.model.CopyrightApplication;
import cn.com.hbhgkj.model.User;

@Repository("copyrightAlterationDao")
public class CopyrightAlterationDaoHibernate extends
		GenericDaoHibernate<CopyrightAlteration, Long> implements
		CopyrightAlterationDao {

	public CopyrightAlterationDaoHibernate() {
		super(CopyrightAlteration.class);
	}

	@Override
	public List<CopyrightAlteration> findByApplicant(User applicant) {
		Session sess = getSession();
		Criteria criteria = sess.createCriteria(CopyrightAlteration.class);
		criteria.add(Restrictions.eq("applicant", applicant));
		return criteria.list();
	}

}
